<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue-router.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<router-link to="/page1">第一个页面</router-link>
			<router-link to="/page2">第二个页面</router-link>
			<router-view></router-view>
		</div>
	</body>
</html>

<!--
2前端路由，
1后端路由
3.spa signle page application,单页面应用程序
-->
<script type="text/javascript">
//1声明路由组件
	var page1 = {
		template:'<h1>这是第一个网页</h1>'
	}
	
	var page2 = {
		template:'<h1>这是第二个网页</h1>'
	}
	
	//2创建路由组件
	var router = new VueRouter({
		routes:[
			{
				path:'/page1',
				component:page1
			},
			{
				path:'/page2',
				component:page2
			}
		]
	})
	
	//3将路由组件挂载到vue实例中
	var vm = new Vue({
		el:"#app",
		router
	})
</script>
